% Devin Koepl

classdef GroundClass < handle
   
    properties (Constant)
        
    end
    
    properties
        y;
        
        kx;
        ky;
        bx;
        by;
        
        % Footprints
        fps = {};
    end
    
    methods
            
        function obj = GroundClass(ground_function)
            [obj.y, obj.kx, obj.ky, obj.bx, obj.by] = feval(ground_function);
        end
        
        function new_fp(obj, tlo, ttd, xtd, ytd, xlo, ylo)            
            obj.fps = { obj.fps{1:end}, FootprintClass( tlo, ttd, xtd, ytd, xlo, ylo, ...
                obj.kx(xtd), obj.ky(xtd), obj.bx(xtd), obj.by(xtd) ) };
        end
        
        function y = ground_height(obj, t, x, xt, yt)
            y = obj.y(x);
            
            for i = 1 : size(obj.fps, 2)
                y = y - obj.fps{i}.footprint_deflection(t, x, xt, yt);
            end
        end
        
        function set_lo(obj, tlo, xlo, ylo)
           obj.fps{end}.tlo = tlo;
           obj.fps{end}.xlo = xlo;
           obj.fps{end}.ylo = ylo;
        end
        
    end    
    
end